<?php

namespace app\commands;


/**
 * ArchivesController implements the CRUD actions for Archives model.
 */
class Mytools
{

    public static function array_value_trim($post_array = [])
    {
        if(null != $post_array && count($post_array) > 0){
            foreach($post_array as $i=>$p){
                $i = trim($i);
                $post_array[$i] = trim($p);
            }
        }
        return $post_array;
    }

    //从二维数组中，抽取一个key的值，再组成一个数组
    public static function two_array_to_keys($post_array = [], $key)
    {
        $res = [];
        if(null != $post_array && count($post_array) > 0){
            foreach($post_array as $p){
                $res[] = trim($p[$key]);
            }
        }
        return $res;
    }
}